package interpreter

type tTokenQueue struct {
	items []*tTokenNode
	size int
	next int
}


func newTokenQueue(nodes []*tTokenNode) *tTokenQueue {
	return &tTokenQueue{
		nodes,
		len(nodes),
		0,
	}
}

func (me *tTokenQueue) Poll() (bool,*tTokenNode) {
	b,v := me.Peek()
	if b {
		me.next++
	}
	return b,v
}


func (me *tTokenQueue) Peek() (bool, *tTokenNode) {
	if me.next >= me.size {
		return false, nil
	}

	it := me.items[me.next]
	return true, it
}

func (me *tTokenQueue) IsEmpty() bool {
	return me.next >= me.size
}